/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author wyr
 */
@Entity
@Table(name = "news_extends_channel_ads")
//@NamedQueries({@NamedQuery(name = "NewsExtendsChannelAds.findAll", query = "SELECT n FROM NewsExtendsChannelAds n"), @NamedQuery(name = "NewsExtendsChannelAds.findByChannleid", query = "SELECT n FROM NewsExtendsChannelAds n WHERE n.newsExtendsChannelAdsPK.channleid = :channleid"), @NamedQuery(name = "NewsExtendsChannelAds.findByAdid", query = "SELECT n FROM NewsExtendsChannelAds n WHERE n.newsExtendsChannelAdsPK.adid = :adid"), @NamedQuery(name = "NewsExtendsChannelAds.findByAdorder", query = "SELECT n FROM NewsExtendsChannelAds n WHERE n.adorder = :adorder")})
public class NewsExtendsChannelAds implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected NewsExtendsChannelAdsPK newsExtendsChannelAdsPK;
    @Column(name = "adorder")
    private Integer adorder;
    @JoinColumn(name = "adid", referencedColumnName = "adid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private NewsAds newsAds;
    @JoinColumn(name = "channleid", referencedColumnName = "channleid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private NewsExtendsChannel newsExtendsChannel;

    public NewsExtendsChannelAds() {
    }

    public NewsExtendsChannelAds(NewsExtendsChannelAdsPK newsExtendsChannelAdsPK) {
        this.newsExtendsChannelAdsPK = newsExtendsChannelAdsPK;
    }

    public NewsExtendsChannelAds(int channleid, int adid) {
        this.newsExtendsChannelAdsPK = new NewsExtendsChannelAdsPK(channleid, adid);
    }

    public NewsExtendsChannelAdsPK getNewsExtendsChannelAdsPK() {
        return newsExtendsChannelAdsPK;
    }

    public void setNewsExtendsChannelAdsPK(NewsExtendsChannelAdsPK newsExtendsChannelAdsPK) {
        this.newsExtendsChannelAdsPK = newsExtendsChannelAdsPK;
    }

    public Integer getAdorder() {
        return adorder;
    }

    public void setAdorder(Integer adorder) {
        this.adorder = adorder;
    }

    public NewsAds getNewsAds() {
        return newsAds;
    }

    public void setNewsAds(NewsAds newsAds) {
        this.newsAds = newsAds;
    }

    public NewsExtendsChannel getNewsExtendsChannel() {
        return newsExtendsChannel;
    }

    public void setNewsExtendsChannel(NewsExtendsChannel newsExtendsChannel) {
        this.newsExtendsChannel = newsExtendsChannel;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (newsExtendsChannelAdsPK != null ? newsExtendsChannelAdsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NewsExtendsChannelAds)) {
            return false;
        }
        NewsExtendsChannelAds other = (NewsExtendsChannelAds) object;
        if ((this.newsExtendsChannelAdsPK == null && other.newsExtendsChannelAdsPK != null) || (this.newsExtendsChannelAdsPK != null && !this.newsExtendsChannelAdsPK.equals(other.newsExtendsChannelAdsPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dp.vo.NewsExtendsChannelAds[newsExtendsChannelAdsPK=" + newsExtendsChannelAdsPK + "]";
    }

}
